//
//  DropControl.m
//  CD1505WeiBo
//
//  Created by 千锋 on 15/12/30.
//  Copyright (c) 2015年 LiChaoRan. All rights reserved.
//

#import "DropControl.h"

@interface DropControl ()

@property(nonatomic,weak)UIView *sView;//用来存储父视图

@property(nonatomic,strong)UIImageView *imgView;

@property(nonatomic,assign)CGRect imgFrame;

@property(nonatomic,strong)UITableView *tableView;

@property(nonatomic,strong)NSMutableArray *dataArray;

@end

@implementation DropControl

- (instancetype)initWithInsideViewFrame:(CGRect)frame inView:(UIView *)view dataSource:(NSArray *)dataArray{
    self=[super init];
    if (self) {
        self.sView=view;
        self.imgFrame=frame;//记录图片位置
        self.frame=[UIScreen mainScreen].bounds;
        self.backgroundColor=[UIColor clearColor];
        [self addTarget:self action:@selector(hide) forControlEvents:UIControlEventTouchDown];
        
        self.imgView=[[UIImageView alloc]init];
        self.imgView.image=[[UIImage imageNamed:@"popover_background"] stretchableImageWithLeftCapWidth:5 topCapHeight:10];
        
        CGRect tableRect=frame;
    }
    return self;
    /**
     *  adsfasdf
     *
     *  @return qER
     */
}

- (void)show{
    [self.sView addSubview:self];
    [self.sView addSubview:self.imgView];
}

- (void)disMiss{
    [self removeFromSuperview];
}

- (void)hide{
    [self disMiss];
    if (_aftBlock) {
        _aftBlock();
    }
}

@end
